package com.internetCafes.spms.common.AIRecognize.handler.impl;

import com.internetCafes.spms.common.AIRecognize.handler.Handler;
import com.internetCafes.spms.web.certificate.vo.AIRecognizeInfo;
import org.springframework.stereotype.Component;

/**
 * @author LinYe
 * @date 2020/10/24
 */
@Component
public class QRCodeWordHandler implements Handler {

    /**
     * 对二维码识别返回字符串进行处理
     * @param word 二维码识别结果
     * @param filePath 图片路径
     * @return 智能识别实体类
     */
    @Override
    public AIRecognizeInfo handle(String word, String filePath) {
        String[] split = word.split("，");
        AIRecognizeInfo aiRecognizeInfo = new AIRecognizeInfo();
        aiRecognizeInfo.setName(split[0]);
        aiRecognizeInfo.setIdCard(split[2]);
        aiRecognizeInfo.setCertificateNo(split[4].substring("证书号:".length()));
        aiRecognizeInfo.setProfession(split[3].substring("岗位:".length()));
        return aiRecognizeInfo;
    }
}
